<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <jsp:include page="/resources/inc/head.jsp" />
    <link href="${basePath}/resources/zheng-admin/plugins/sort_plugin/css/style.css" rel="stylesheet"/>
    <link href="${basePath}/resources/manage/css/product/product/create.css" rel="stylesheet"/>
    <link href="${basePath}/resources/zheng-admin/plugins/jqueryStep/css/jquery.step.css" rel="stylesheet"/>
</head>
<body>
<div class="contains">
    <div id="step">
    </div>
    <div class="sortContains" id="categoryDiv">
        <!--商品分类-->
        <div class="wareSort clearfix">
            <ul id="sort1"></ul>
            <ul id="sort2" style="display: none;"></ul>
            <ul id="sort3" style="display: none;"></ul>
        </div>
        <div class="selectedSort"><p>您当前选择的商品类别是：</p><i id="selectedSort"></i></div>
        <div class="wareSortBtn">
            <input id="makeProduct" type="button" value="下一步" disabled="disabled"/>
        </div>
    </div>
    <form class="layui-form layui-form-pane">
        <div class="productDiv" id="productDiv">
            <div id="productInfo" class="div-info">
                <div class="div-info-title">
                    <p>商品属性</p>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">商品名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入商品名称"
                               class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">商品名称</div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">商品分类</label>
                    <div class="layui-input-inline" style="width: 81%;">
                        <input name="productCategoryId" type="hidden" lay-verify="required">
                        <input type="text" class="layui-input" name="productCategoryName" readonly="readonly">
                    </div>
                    <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" onclick="doCategory()">编辑
                    </button>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">品牌</label>
                    <div class="layui-input-inline">
                        <select name="brandId" lay-verify="required" lay-search="" id="brandDiv">
                            <option value="">请选择品牌</option>
                        </select>
                    </div>
                    <div class="layui-form-mid layui-word-aux">在选项框中输入想寻找的品牌，即可搜索匹配的品牌</div>
                </div>
            </div>
            <div id="productImage" class="div-info">
                <div class="div-info-title">
                    <p>商品图片</p>
                </div>
                <div id="productImg">
                    <div class="layui-upload">
                        <div class="image-list">
                            <div class="layui-upload-list product-image-list">
                                <i class="layui-icon deleteImage" onclick="deleteImg(this)">&#x1007;</i>
                                <img src="${basePath}/resources/manage/image/noImg.png"
                                     class="selectImage productImage">
                                <input type="hidden" isMain="true" name="image">
                            </div>
                            <p>主图</p>
                        </div>
                        <div class="image-list">
                            <div class="layui-upload-list product-image-list">
                                <i class="layui-icon deleteImage" onclick="deleteImg(this)">&#x1007;</i>
                                <img src="${basePath}/resources/manage/image/noImg.png"
                                     class="selectImage productImage">
                                <input type="hidden" name="image">
                            </div>
                            <p>细节图</p>
                        </div>
                        <div class="image-list">
                            <div class="layui-upload-list product-image-list">
                                <i class="layui-icon deleteImage" onclick="deleteImg(this)">&#x1007;</i>
                                <img src="${basePath}/resources/manage/image/noImg.png"
                                     class="selectImage productImage">
                                <input type="hidden" name="image">
                            </div>
                            <p>细节图</p>
                        </div>
                        <div class="image-list">
                            <div class="layui-upload-list product-image-list">
                                <i class="layui-icon deleteImage" onclick="deleteImg(this)">&#x1007;</i>
                                <img src="${basePath}/resources/manage/image/noImg.png"
                                     class="selectImage productImage">
                                <input type="hidden" name="image">
                            </div>
                            <p>细节图</p>
                        </div>
                        <div class="image-list">
                            <div class="layui-upload-list product-image-list">
                                <i class="layui-icon deleteImage" onclick="deleteImg(this)">&#x1007;</i>
                                <img src="${basePath}/resources/manage/image/noImg.png"
                                     class="selectImage productImage">
                                <input type="hidden" name="image">
                            </div>
                            <p>细节图</p>
                        </div>
                    </div>
                </div>
            </div>
            <div id="paramDiv" class="div-info">
                <div class="div-info-title">
                    <p>商品参数</p>
                </div>
                <div id="params">
                </div>
                <div class="layui-form-item">
                    <button class="layui-btn layui-btn-normal layui-btn-sm add-param-button" style="float: left"
                            type="button" onclick="showAddParam()">添加参数
                    </button>
                    <div id="addParam" hidden>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="AddParamName" autocomplete="off"
                                   placeholder="请输入新增的参数名称">
                        </div>
                        <div class="param-add-icon" onclick="addParam()">
                            <i class="layui-icon" style="font-size: 22px;">&#xe618;</i>
                        </div>
                    </div>
                </div>
            </div>
            <div class="div-info">
                <div class="div-info-title">
                    <p>商品描述</p>
                </div>
                <div class="description-div">
                    <script id="description" name="description" type="text/plain">
                    </script>
                </div>
            </div>
            <div class="wareSortBtnGroup">
                <div class="wareSortBtnParallel">
                    <input type="button" value="返回上一步" onclick="doCategory()"/>
                </div>
                <div class="wareSortBtnParallel">
                    <input id="makeSku" type="button" lay-submit value="下一步" lay-filter="productForm">
                </div>
            </div>
        </div>
    </form>
    <form class="layui-form layui-form-pane" id="skuForm">
        <div class="productDiv" id="skuDiv">
            <div id="attributeDiv" class="div-info">
                <div class="div-info-title">
                    <p>商品规格</p>
                </div>
                <div id="attributes">
                </div>
            </div>
            <div id="skuInfo" class="div-info" hidden>
                <div class="div-info-title">
                    <p>商品sku</p>
                </div>
                <div id="skuImageDiv" hidden>
                    <table class="layui-table">
                        <thead class="sku-tHead-tr">
                        <tr>
                            <th>属性</th>
                            <th>图片</th>
                        </tr>
                        </thead>
                        <tbody id="skuImageTBody"></tbody>
                    </table>
                </div>
                <div id="skus">
                    <table class="layui-table">
                        <thead id="skuTHead">
                        <tr id="thParent" class="sku-tHead-tr">
                        </tr>
                        </thead>
                        <tbody id="skuTBody">
                        </tbody>
                    </table>
                </div>
            </div>
            <div id="noAttributeSkuInfo" class="div-info" hidden>
            </div>
            <div class="wareSortBtnGroup">
                <div class="wareSortBtnParallel">
                    <input type="button" value="返回上一步" onclick="doProduct()"/>
                </div>
                <div class="wareSortBtnParallel">
                    <input id="makePublish" type="button" lay-submit value="下一步" lay-filter="skuForm">
                </div>
            </div>
        </div>
    </form>
    <form class="layui-form layui-form-pane" id="_form" hidden>
        <div id="productLastInfo" class="div-info">

        </div>
        <div id="skuLastInfo" class="div-info">

        </div>
        <div class="wareSortBtnGroup">
            <div class="wareSortBtnParallel">
                <input type="button" value="返回上一步" onclick="returnSku()"/>
            </div>
            <div class="wareSortBtnParallel">
                <input type="button" value="发布并上架" onclick="submitAll(true)">
            </div>
            <div class="wareSortBtnParallel">
                <input type="button" value="仅发布" onclick="submitAll(false)">
            </div>
        </div>
    </form>
</div>
<jsp:include page="/resources/inc/footer.jsp" />
<script>
    var productCategoryId;
    var nowCategoryId;
    var productCategoryName;
    var attributeList;
    var paramList;
    var paramTypes = ${paramTypes};
    var brandId;
    var path = "${productCategory.path}";
    var allCategoryUrl = "${basePath}/manage/product/category/all";
    var allBrandUrl = "${basePath}/manage/product/brand/all";
    var subUrl = "${basePath}/manage/product/product/create";
    var attributeAndParamUrl = "${basePath}/manage/product/product/getAttributeAndParam";
    var $step = $("#step");
    var ueditorUrl = "${ZHENG_OSS_DOMAIN}";
    var basePath = "${basePath}";
</script>
<script src="${basePath}/resources/zheng-admin/plugins/sort_plugin/js/jquery.sort.js"></script>
<script src="${basePath}/resources/zheng-admin/plugins/jqueryStep/js/jquery.step.min.js"></script>
<script src="${basePath}/resources/manage/js/product/product/create.js"></script>
<!-- 配置文件 -->
<script src="${basePath}/resources/zheng-admin/plugins/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script src="${basePath}/resources/zheng-admin/plugins/ueditor/ueditor.all.js"></script>
<script>
    UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
    UE.Editor.prototype.getActionUrl = function (action) {
        if (action == 'uploadimage' || action == 'uploadscrawl' || action == 'uploadvideo') {
            return '${ZHENG_OSS_DOMAIN}/qiniu/oss/uploadUeditor';
        } else {
            return this._bkGetActionUrl.call(this, action);
        }
    }
</script>
</body>
</html>
